package com.example.sneakerappforme1105.dao;


import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.example.sneakerappforme1105.bean.Category;

import java.util.List;

@Dao
public interface CategoryDao {
    @Query("SELECT * FROM tb_category")
    List<Category> queryAllCategory();  // 查询所有种类

    @Query("SELECT * FROM tb_category WHERE categoryId=:id")
    Category queryCategoryById(long id);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long insertOneCategory(Category category);  // 插入某种种类

    @Update(onConflict = OnConflictStrategy.REPLACE)
    int updateCategory(Category category);

    @Query("DELETE FROM tb_category where categoryId=:id")
    void deleteCategoryById(long id);


}
